/**
 * Created by mac1 on 2017/11/9.
 */
var http = require('http');

http.createServer(function (request, response){
  response.writeHead(200,{
    'Content-Type':'text-plain'
  });

  var body = [];

  console.log(request.method);
  console.log(request.headers);

  request.on('data',function (chunk) {
    body.push(chunk);
  });

  request.on('end',function () {
    body = Buffer.concat(body);
    console.log(body.toString());
  });

  response.end('Hello World\n');
}).listen(8124);